package fr.umlv.m2.jee.spij.service.fieldWork;

import fr.umlv.m2.jee.spij.service.ldap.authentification.DisplayActor;
import org.springframework.binding.message.MessageContext;

import java.util.List;

/**
 * Provides services about field works.
 *
 * @author thomas magny
 */
public interface IDisplayFieldWorkService {

    /**
     * Returns all the field works given for a unit.
     *
     * @param unitId the unit foreign key.
     * @param context the message context.
     *
     * @return a list of DTO that contains the displayed data.
     */
    public List<DisplayFieldWork> getAllDisplayFieldWork(long unitId, MessageContext context);

    /**
     * Returns all the fieldwork given for an user and a unit.
     *
     * @param unitId the unit foreign key.
     * @param currentUser the current user.
     * @param context the message context.
     *
     * @return a list of DTO that contains the displayed data.
     */
    public List<DisplayFieldWork> getAllDisplayFieldWorkPerUser(final long unitId, DisplayActor currentUser, MessageContext context);

    /**
     * Returns displayed data about specific field work.
     *
     * @param id the fieldWork primary key
     * @param context the message context.
     *
     * @return the data to display
     */
    public DisplayFieldWork getFieldWorkById(long id, MessageContext context);

    /**
     * Creates a new field work to persist into database. The new field work is
     * assigned to a unit according to the unitId given in argument.
     *
     * @param displayFieldWork contains the data to create the new field work
     * @param unitId           the unit foreign key
     * @param context          the message context
     *
     * @return true whether the fieldWork has been created or false otherwise
     */
    public boolean createFieldWork(DisplayFieldWork displayFieldWork, long unitId,
                                   MessageContext context);

    /**
     * Updates a field work with datas given into DisplayFieldWork object
     *
     * @param modifiedFieldWork the modified data
     * @param context           the message context
     *
     * @return true whether the fieldWork has been updated or false otherwise
     */
    public boolean updateFieldWorkById(final DisplayFieldWork modifiedFieldWork, final MessageContext context);

    /**
     * Removes a field work according to its primary key.
     *
     * @param id      the primary key
     * @param context the message context
     *
     * @return true whether the fieldWork has been well removed or false
     *         otherwise.
     */
    public boolean deleteFieldWorkById(final long id, final MessageContext context);
}
